{% extends "admin/base.html" %}
{% load static %}

{% block title %}{{ title }} | {{ site_title|default:_('音乐推荐系统管理') }}{% endblock %}

{% block branding %}
<h1 id="site-name">
    <img src="{% static 'player/images/icon.png' %}" alt="Logo" height="30" onerror="this.style.display='none'">
    <strong>{{ site_header|default:_('音乐推荐系统') }}</strong> 管理后台
</h1>
{% endblock %}

{% block nav-global %}{% endblock %}

{% block extrastyle %}
{{ block.super }}
<style>
    :root {
        --primary: #1976d2;
        --secondary: #2196f3;
        --accent: #42a5f5;
        --primary-fg: #fff;
        --body-bg: #f5f7fa;
        --body-fg: #333;
        --header-bg: #1976d2;
        --header-fg: #fff;
        --selected-bg: #e3f2fd;
        --selected-fg: #1976d2;
        --link-fg: #1976d2;
        --link-hover-color: #1565c0;
    }

    /* 整体设计 */
    body {
        font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
        background-color: var(--body-bg);
        color: var(--body-fg);
    }

    /* 页眉 */
    #header {
        background: linear-gradient(to right, var(--primary), var(--secondary));
        color: var(--primary-fg);
        padding: 15px 40px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        height: auto;
        line-height: normal;
    }

    #branding h1, #header a:link, #header a:visited {
        color: var(--header-fg);
    }

    #branding h1 {
        font-weight: 300;
        font-size: 24px;
        letter-spacing: 0.5px;
    }

    #branding h1 strong {
        font-weight: 600;
    }

    #branding h1 img {
        margin-right: 10px;
        vertical-align: middle;
    }

    #user-tools {
        font-size: 13px;
        padding: 0;
        letter-spacing: 0.5px;
    }

    #user-tools a {
        border-bottom: none;
        text-decoration: none;
        padding: 5px 10px;
        margin-left: 5px;
        border-radius: 4px;
        transition: all 0.3s ease;
    }

    #user-tools a:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: #fff;
    }

    #user-tools a:focus {
        background-color: rgba(255, 255, 255, 0.25);
        color: #fff;
        text-decoration: none;
    }

    /* 侧边栏 */
    .dashboard #content {
        width: calc(100% - 300px);
    }

    #content-related {
        background: white;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        padding: 0;
        margin-right: 0;
        width: 280px;
    }

    #content-related h2 {
        background: linear-gradient(to right, var(--primary), var(--secondary));
        color: white;
        padding: 15px 20px;
        margin: 0;
        font-size: 16px;
        font-weight: 500;
        border-radius: 10px 10px 0 0;
    }

    #content-related .module {
        box-shadow: none;
        margin-bottom: 20px;
        border-radius: 10px;
        overflow: hidden;
    }

    #content-related h3 {
        font-size: 14px;
        padding: 15px 20px 0 20px;
        margin: 0;
        font-weight: 600;
        background: white;
        color: #666;
    }

    #content-related .actionlist {
        padding: 0 20px 15px 20px;
    }

    #content-related .actionlist li {
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
        line-height: 1.5;
    }

    #content-related .actionlist li:last-child {
        border-bottom: none;
    }

    /* 内容区域 */
    #content {
        padding: 30px 40px;
    }

    .module {
        background: white;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        margin-bottom: 25px;
        overflow: hidden;
    }

    .module h2, .module caption {
        background: linear-gradient(to right, var(--primary), var(--secondary));
        color: white;
        font-weight: 500;
        font-size: 16px;
        padding: 15px 20px;
        margin: 0;
    }

    .module.filtered h2 {
        border-radius: 10px 10px 0 0;
    }

    /* 表格 */
    .results {
        width: 100%;
        border-spacing: 0;
    }

    .results tr th, .results tr td {
        padding: 12px 15px;
    }

    .results tr th {
        background-color: #f8fafd;
        font-weight: 600;
        font-size: 13px;
        color: #555;
        border-bottom: 1px solid #eee;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .results tr:nth-child(even) {
        background-color: #f8fafd;
    }

    .results tr:hover {
        background-color: #e3f2fd;
    }

    .paginator {
        padding: 15px 20px;
        background-color: #f8fafd;
        border-top: 1px solid #eee;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .paginator a {
        display: inline-block;
        padding: 5px 10px;
        border-radius: 4px;
        background-color: #fff;
        border: 1px solid #ddd;
        margin: 0 3px;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .paginator a:hover, .paginator a:focus {
        background-color: #e3f2fd;
        border-color: #c9e2fc;
    }

    .paginator .this-page {
        background-color: var(--primary);
        color: white;
        border: 1px solid var(--primary);
        padding: 5px 10px;
        border-radius: 4px;
        margin: 0 3px;
        font-weight: 600;
    }

    /* 按钮 */
    .button, input[type=submit], input[type=button], .submit-row input, a.button {
        background-color: var(--primary);
        color: white;
        border: none;
        border-radius: 5px;
        padding: 10px 15px;
        font-weight: 500;
        transition: all 0.3s ease;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .button:hover, input[type=submit]:hover, input[type=button]:hover,
    .submit-row input:hover, a.button:hover {
        background-color: var(--link-hover-color);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    }

    .button.default, input[type=submit].default, .submit-row input.default {
        background-color: var(--accent);
        font-weight: 600;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    }

    .button.default:hover, input[type=submit].default:hover,
    .submit-row input.default:hover {
        background-color: var(--secondary);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    /* 表单 */
    form .aligned label {
        color: #555;
        font-weight: 600;
    }

    .aligned label.required:after {
        content: '*';
        color: #f44336;
        margin-left: 3px;
    }

    fieldset {
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        padding: 20px;
        margin-bottom: 25px;
    }

    fieldset.collapsed {
        border: none;
        padding: 0;
    }

    fieldset.collapsed h2 {
        border-radius: 8px;
    }

    .fieldset .form-row, form .aligned .form-row {
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .fieldset .form-row:last-child, form .aligned .form-row:last-child {
        border-bottom: none;
    }

    input, textarea, select, .form-row select {
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 5px;
        transition: all 0.3s ease;
    }

    input:focus, textarea:focus, select:focus, .form-row select:focus {
        border-color: var(--secondary);
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
        outline: none;
    }

    /* 错误和消息 */
    ul.messagelist li {
        padding: 12px 20px;
        margin: 0 0 20px 0;
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        font-weight: 500;
    }

    ul.messagelist li.success {
        background: #e8f5e9;
        color: #2e7d32;
        border-left: 5px solid #4caf50;
    }

    ul.messagelist li.warning {
        background: #fff8e1;
        color: #ff8f00;
        border-left: 5px solid #ffc107;
    }

    ul.messagelist li.error {
        background: #fbe9e7;
        color: #d84315;
        border-left: 5px solid #f44336;
    }

    /* 登录页面 */
    .login {
        background: linear-gradient(135deg, #1976d2, #64b5f6);
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .login #header {
        background: transparent;
        box-shadow: none;
        text-align: center;
        padding: 0;
        margin-bottom: 30px;
    }

    .login #content {
        background: white;
        padding: 40px;
        border-radius: 15px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        width: 400px;
        max-width: 90%;
    }

    .login #container {
        padding: 0;
        box-shadow: none;
        width: auto;
    }

    .login form {
        margin-top: 20px;
    }

    .login .form-row {
        margin-bottom: 20px;
    }

    .login .form-row label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        color: #555;
    }

    .login .form-row input {
        width: 100%;
        padding: 12px 15px;
        border: 1px solid #ddd;
        border-radius: 6px;
        transition: all 0.3s ease;
    }

    .login .form-row input:focus {
        border-color: var(--secondary);
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
        outline: none;
    }

    .login .submit-row {
        padding: 0;
        text-align: center;
        border: none;
        background: none;
        margin-top: 20px;
    }

    .login .submit-row input {
        width: 100%;
        padding: 12px 15px;
        background: linear-gradient(to right, var(--primary), var(--secondary));
        color: white;
        border: none;
        border-radius: 6px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        letter-spacing: 0.5px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    }

    .login .submit-row input:hover {
        background: linear-gradient(to right, #1565c0, #1e88e5);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        transform: translateY(-2px);
    }

    /* 导航菜单 */
    div.breadcrumbs {
        background: #f8fafd;
        padding: 15px 40px;
        color: #666;
        border-bottom: 1px solid #e0e0e0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    }

    div.breadcrumbs a {
        color: var(--primary);
        text-decoration: none;
        transition: all 0.3s ease;
    }

    div.breadcrumbs a:hover {
        color: var(--link-hover-color);
    }

    /* 导航栏 */
    #changelist-filter {
        background: white;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        overflow: hidden;
        margin-left: 20px;
        margin-bottom: 25px;
    }

    #changelist-filter h2 {
        background: linear-gradient(to right, var(--primary), var(--secondary));
        color: white;
        padding: 15px 20px;
        margin: 0;
        font-size: 16px;
        font-weight: 500;
    }

    #changelist-filter h3 {
        font-size: 14px;
        padding: 15px 20px 10px 20px;
        margin: 0;
        font-weight: 600;
        color: #666;
    }

    #changelist-filter ul {
        padding: 0 20px 15px 20px;
        margin: 0;
    }

    #changelist-filter li {
        list-style-type: none;
        padding: 5px 0;
    }

    #changelist-filter a {
        color: #666;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    #changelist-filter a:hover {
        color: var(--primary);
    }

    #changelist-filter a.selected {
        color: var(--primary);
        font-weight: 600;
    }

    /* 搜索表单 */
    #changelist-search .quiet {
        color: #666;
    }

    #changelist-search input[type="submit"] {
        padding: 10px 15px;
        margin-left: 10px;
    }

    #changelist-search #searchbar {
        padding: 10px;
        min-width: 300px;
        border: 1px solid #ddd;
        border-radius: 5px;
    }

    /* App索引 */
    .app-music.module {
        transition: all 0.3s ease;
    }

    .app-music.module:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    }

    /* 日期层级链接 */
    .date-hierarchy {
        background: white;
        padding: 15px 20px;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        margin-bottom: 20px;
    }

    .date-hierarchy a, .date-hierarchy span {
        margin-right: 10px;
    }

    /* 编辑链接 */
    .addlink, .changelink, .viewlink, .deletelink {
        position: relative;
        padding-left: 20px;
        text-decoration: none;
    }

    .addlink:before {
        content: '+';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-weight: bold;
        color: #4caf50;
    }

    .changelink:before {
        content: '✎';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-weight: bold;
        color: #ff9800;
    }

    .viewlink:before {
        content: '👁';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-weight: bold;
        color: #2196f3;
    }

    .deletelink:before {
        content: '✕';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-weight: bold;
        color: #f44336;
    }
</style>
{% endblock %}
